Skip to content

feat: implement auto-proceed functionality with controls for pause/re… - #404

Open
estruyf wants to merge 3 commits into
devfrom
issue/402
Open

feat: implement auto-proceed functionality with controls for pause/re…#404
estruyf wants to merge 3 commits into
devfrom
issue/402

Conversation

@estruyf

@estruyf estruyf commented May 19, 2026

Copy link
Copy Markdown
Owner

Implementation for #402

Fixes #

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor

Checklist

  • My code follows the project coding style and conventions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added/updated tests as needed
  • All tests pass locally
  • My changes generate no new warnings
  • I have linked relevant issues (if applicable)

Screenshots (if applicable)

Additional context

Note

Add auto-proceed functionality with pause/resume controls to demo scenes

  • Adds autoAdvanceAfter per-scene config and autoLoop file config to drive automatic scene advancement in DemoRunner.ts
  • Countdown timer runs after each scene with autoAdvanceAfter > 0, advancing to the next scene when it elapses; spacebar toggles pause/resume during presentation
  • Adds a new 'Quick Actions' tree view panel (QuickActionsPanel.ts) that surfaces presentation and auto-proceed controls with live countdown in the sidebar
  • Resetting or navigating to a previous scene cancels any active auto-proceed timer and clears its UI state
  • Risk: autoLoop requires every enabled scene to specify autoAdvanceAfter; missing values cause an error and stop the loop rather than silently skipping

Macroscope summarized b387f95.

Summary by CodeRabbit

  • New Features
    • Auto‑proceed countdown with pause/resume controls and toggle shortcut (space) during presentations.
    • Quick Actions sidebar panel (“Quick Actions”) exposing presentation controls and common demo commands.
    • Command palette entries for quick toggling, pausing, and resuming auto‑proceed.
    • Demo configuration extended with per‑scene auto‑advance timing and optional automatic looping.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR introduces an auto-proceed feature that automatically advances scenes after a configurable delay, with pause/resume controls accessible via a new Quick Actions sidebar panel. The implementation extends config schema with autoLoop and autoAdvanceAfter properties, registers new commands, builds a tree view UI for quick access, and orchestrates countdown scheduling and state management in DemoRunner.

Changes

Auto-Proceed Feature Implementation

Layer / File(s) Summary
Config Schema & Data Model Extensions
packages/common/src/models/Demos.ts, packages/common/src/constants/Command.ts, packages/common/src/utils/demoNormalizer.ts
ActConfig, DemoConfig, Scene, and Demo interfaces each gain optional timing fields: autoLoop?: boolean and autoAdvanceAfter?: number. Command constants add three auto-proceed command identifiers. Normalizer helpers map these properties during v3↔legacy config conversions.
Context Keys & Extension Manifest Registration
apps/vscode-extension/src/constants/ContextKeys.ts, apps/vscode-extension/package.json
New context keys autoProceedActive and autoProceedPaused track auto-proceed state. Manifest registers toggle/pause/resume commands with icons, configures their visibility in the command palette based on context conditions, introduces a "Quick Actions" view container with zap icon, and adds a space key binding (active only during presentation with auto-proceed enabled).
Quick Actions Tree View Panel & Provider
apps/vscode-extension/src/panels/QuickActionsPanel.ts, apps/vscode-extension/src/providers/QuickActionsTreeviewProvider.ts
QuickActionsTreeviewProvider implements VS Code's TreeDataProvider to dynamically generate quick action items: presentation mode toggle, pause/resume auto-proceed, and fixed commands (timer, presenter view, reset, export, search, etc.). QuickActionTreeItem renders each action with icon, tooltip, and command wiring. QuickActionsPanel wraps the tree view and exposes register(), update(), updatePresentationMode(), and updateAutoProceed() methods to synchronize UI state with DemoRunner.
Extension Activation Wiring
apps/vscode-extension/src/extension.ts
QuickActionsPanel.register() is called during activation to initialize and register the tree view with VS Code.
DemoRunner Auto-Proceed Orchestration & Scene Transitions
apps/vscode-extension/src/services/DemoRunner.ts
Adds auto-proceed timer state management (timer reference, interval, paused flag, countdown seconds) and public getters for paused status and remaining countdown. Registers toggle/pause/resume commands, updating context keys and synchronizing QuickActionsPanel after each action. Implements countdown scheduling: a 1-second interval decrements remaining time and fires COMMAND.start when elapsed. Pause clears timers and sets context; resume restarts the countdown. Presentation-mode toggling and demo reset both clear auto-proceed state and update the panel. When starting a demo or navigating backward, any active countdown is cancelled. Auto-loop validation occurs when reaching the end of a scene list: if enabled, requires all enabled scenes have autoAdvanceAfter, then restarts from the beginning. Scene transitions schedule a new countdown when autoAdvanceAfter is configured, respecting the current paused state and updating the panel with the countdown display.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A rabbit taps the sidebar bright,
Timers tick through demo night.
Pause, resume, or let it flow,
Quick Actions make the show. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main feature being introduced: auto-proceed functionality with pause/resume controls.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/402

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 19, 2026

Copy link
Copy Markdown

Deploying demo-time with  Cloudflare Pages  Cloudflare Pages

Latest commit: b387f95
Status:🚫  Build failed.

View logs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/vscode-extension/src/services/DemoRunner.ts (1)

453-467: 💤 Low value

Un-awaited recursive call follows existing pattern but could cause subtle races.

The recursive DemoRunner.start(item) call at line 465 is not awaited, matching the existing pattern at lines 491-494. While consistent, this means the outer await commands.executeCommand(COMMAND.start) (line 259) resolves before the looped iteration completes. If rapid user actions occur during the brief window, state could race.

Consider awaiting the recursive call for safety:

Proposed fix
         executingFile.demo = [];
         await DemoRunner.setExecutedDemoFile(executingFile);
-        DemoRunner.start(item);
+        await DemoRunner.start(item);
         return;
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/vscode-extension/src/services/DemoRunner.ts` around lines 453 - 467, The
auto-loop path performs a non-awaited recursive call to DemoRunner.start(item),
which can allow the outer caller to proceed before the restarted run completes
and cause race conditions; update this block to await the recursive restart
(await DemoRunner.start(item)) and ensure any surrounding callers handle the
returned promise accordingly (the relevant symbols are DemoRunner.start,
DemoRunner.setExecutedDemoFile, and the fileDemo?.autoLoop branch) so state is
fully updated before control returns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/vscode-extension/src/panels/QuickActionsPanel.ts`:
- Around line 11-16: QuickActionsPanel.register currently creates a TreeView
(QuickActionsPanel.treeView) but doesn't add the returned disposable to the
extension singleton's subscriptions; change register so after creating the
TreeView you push the disposable into Extension.getInstance().subscriptions (and
keep creating QuickActionsPanel.quickActionsProvider as-is) to ensure cleanup on
deactivation; apply the same subscription fix to DemoPanel and ResourcesPanel
where createTreeView is used.

In `@packages/common/src/utils/demoNormalizer.ts`:
- Line 15: demoConfigToActConfig currently omits the autoLoop field causing loss
when converting legacy configs; update demoConfigToActConfig to copy autoLoop
from the source config into the returned act config (the same key
normalizeActConfig maps), e.g. set autoLoop: config.autoLoop (or fallback to
existing default behavior) so the autoLoop setting is preserved through legacy →
v3 conversion.

---

Nitpick comments:
In `@apps/vscode-extension/src/services/DemoRunner.ts`:
- Around line 453-467: The auto-loop path performs a non-awaited recursive call
to DemoRunner.start(item), which can allow the outer caller to proceed before
the restarted run completes and cause race conditions; update this block to
await the recursive restart (await DemoRunner.start(item)) and ensure any
surrounding callers handle the returned promise accordingly (the relevant
symbols are DemoRunner.start, DemoRunner.setExecutedDemoFile, and the
fileDemo?.autoLoop branch) so state is fully updated before control returns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d129f991-a04c-4c81-9588-6b3a48796447

📥 Commits

Reviewing files that changed from the base of the PR and between a8ceb85 and b1e9902.

📒 Files selected for processing (9)
  • apps/vscode-extension/package.json
  • apps/vscode-extension/src/constants/ContextKeys.ts
  • apps/vscode-extension/src/extension.ts
  • apps/vscode-extension/src/panels/QuickActionsPanel.ts
  • apps/vscode-extension/src/providers/QuickActionsTreeviewProvider.ts
  • apps/vscode-extension/src/services/DemoRunner.ts
  • packages/common/src/constants/Command.ts
  • packages/common/src/models/Demos.ts
  • packages/common/src/utils/demoNormalizer.ts

Comment on lines +11 to +16
public static register() {
QuickActionsPanel.quickActionsProvider = new QuickActionsTreeviewProvider();
QuickActionsPanel.treeView = window.createTreeView('demo-time-quick-actions', {
treeDataProvider: QuickActionsPanel.quickActionsProvider,
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether the Quick Actions TreeView is disposed/subscribed via ExtensionContext.
rg -n --type=ts "createTreeView\\(|QuickActionsPanel\\.register\\(|subscriptions\\.push\\(|\\.dispose\\(" apps/vscode-extension/src

Repository: estruyf/vscode-demo-time

Length of output: 9170


🏁 Script executed:

sed -n '45,70p' apps/vscode-extension/src/extension.ts

Repository: estruyf/vscode-demo-time

Length of output: 769


🏁 Script executed:

sed -n '1,100p' apps/vscode-extension/src/extension.ts | head -50

Repository: estruyf/vscode-demo-time

Length of output: 1568


🏁 Script executed:

cat -n apps/vscode-extension/src/services/Extension.ts | head -80

Repository: estruyf/vscode-demo-time

Length of output: 2326


🏁 Script executed:

sed -n '235,250p' apps/vscode-extension/src/panels/DemoPanel.ts

Repository: estruyf/vscode-demo-time

Length of output: 515


🏁 Script executed:

sed -n '210,235p' apps/vscode-extension/src/panels/DemoPanel.ts

Repository: estruyf/vscode-demo-time

Length of output: 683


🏁 Script executed:

grep -n "public static register" apps/vscode-extension/src/panels/DemoPanel.ts

Repository: estruyf/vscode-demo-time

Length of output: 100


🏁 Script executed:

sed -n '18,45p' apps/vscode-extension/src/panels/DemoPanel.ts

Repository: estruyf/vscode-demo-time

Length of output: 886


🏁 Script executed:

sed -n '180,215p' apps/vscode-extension/src/panels/DemoPanel.ts

Repository: estruyf/vscode-demo-time

Length of output: 830


🏁 Script executed:

sed -n '1,40p' apps/vscode-extension/src/panels/ResourcesPanel.ts

Repository: estruyf/vscode-demo-time

Length of output: 697


Subscribe the TreeView to extension lifecycle via the Extension singleton.

createTreeView returns a disposable resource that should be registered with Extension.getInstance().subscriptions to ensure proper cleanup on extension deactivation, consistent with command and provider registration patterns used throughout the codebase.

The proposed refactor's approach of adding a context parameter doesn't align with this extension's singleton pattern. Instead, add the subscription using the Extension class's existing accessor:

Corrected refactor
   public static register() {
     QuickActionsPanel.quickActionsProvider = new QuickActionsTreeviewProvider();
     QuickActionsPanel.treeView = window.createTreeView('demo-time-quick-actions', {
       treeDataProvider: QuickActionsPanel.quickActionsProvider,
     });
+    Extension.getInstance().subscriptions.push(QuickActionsPanel.treeView);
   }

Note: This same issue affects DemoPanel and ResourcesPanel, which also create TreeViews without subscribing them.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static register() {
QuickActionsPanel.quickActionsProvider = new QuickActionsTreeviewProvider();
QuickActionsPanel.treeView = window.createTreeView('demo-time-quick-actions', {
treeDataProvider: QuickActionsPanel.quickActionsProvider,
});
}
public static register() {
QuickActionsPanel.quickActionsProvider = new QuickActionsTreeviewProvider();
QuickActionsPanel.treeView = window.createTreeView('demo-time-quick-actions', {
treeDataProvider: QuickActionsPanel.quickActionsProvider,
});
Extension.getInstance().subscriptions.push(QuickActionsPanel.treeView);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/vscode-extension/src/panels/QuickActionsPanel.ts` around lines 11 - 16,
QuickActionsPanel.register currently creates a TreeView
(QuickActionsPanel.treeView) but doesn't add the returned disposable to the
extension singleton's subscriptions; change register so after creating the
TreeView you push the disposable into Extension.getInstance().subscriptions (and
keep creating QuickActionsPanel.quickActionsProvider as-is) to ensure cleanup on
deactivation; apply the same subscription fix to DemoPanel and ResourcesPanel
where createTreeView is used.

version: config.version,
timer: config.timer,
engageTime: config.engageTime,
autoLoop: config.autoLoop,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve autoLoop in legacy → v3 conversion as well.

autoLoop is mapped in normalizeActConfig, but demoConfigToActConfig currently drops it. This causes silent loss of the setting when converting from legacy config to v3.

Proposed fix
 export function demoConfigToActConfig(config: DemoConfig): ActConfig {
   return {
     $schema: config.$schema,
     title: config.title,
     description: config.description,
     version: 3,
     timer: config.timer,
     engageTime: config.engageTime,
+    autoLoop: config.autoLoop,
     scenes: config.demos.map((demo) => demoToScene(demo)),
   };
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/common/src/utils/demoNormalizer.ts` at line 15,
demoConfigToActConfig currently omits the autoLoop field causing loss when
converting legacy configs; update demoConfigToActConfig to copy autoLoop from
the source config into the returned act config (the same key normalizeActConfig
maps), e.g. set autoLoop: config.autoLoop (or fallback to existing default
behavior) so the autoLoop setting is preserved through legacy → v3 conversion.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/common/src/models/Demos.ts (1)

54-54: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Document the time units for autoAdvanceAfter.

The autoAdvanceAfter field is a number but doesn't specify units. Users configuring this field won't know whether to use seconds (e.g., 5) or milliseconds (e.g., 5000). Add a JSDoc comment clarifying the expected units.

📝 Suggested documentation
 export interface Scene {
   id?: string;
   title: string;
   description?: string;
   moves: Move[];
   icons?: Icons;
   notes?: Notes;
   disabled?: boolean;
+  /**
+   * Time in seconds to wait before automatically advancing to the next scene.
+   * Must be a positive number. Used with autoLoop to create automatic demo flows.
+   */
   autoAdvanceAfter?: number;
 }

Apply the same documentation pattern to the Demo interface at line 66.

Also applies to: 66-66

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/common/src/models/Demos.ts` at line 54, Add JSDoc comments
clarifying the time units for the numeric autoAdvanceAfter property and the
corresponding field on the Demo interface: update the declaration for
autoAdvanceAfter (and the Demo interface's autoAdvanceAfter) to include a brief
JSDoc like "`@param` autoAdvanceAfter - number of milliseconds to wait before
auto-advancing" (or seconds if you prefer, but be explicit) so consumers know
the expected units and behavior.
🧹 Nitpick comments (1)
apps/vscode-extension/package.json (1)

916-919: Spacebar keybinding is appropriately scoped but will override default behavior.

The space key is bound to toggleAutoProceed when in presentation mode with auto-proceed active. While the when clause appropriately limits the scope, users should be aware that pressing space in this context will toggle auto-proceed rather than performing default actions (e.g., scrolling in some panels). This seems intentional for quick pause/resume during auto-advancing presentations.

Consider documenting this keybinding behavior in user-facing documentation or the command description so presenters know they can use space to quickly pause/resume during auto-proceed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/vscode-extension/package.json` around lines 916 - 919, The spacebar
keybinding for demo-time.toggleAutoProceed is scoped to presentation mode but
overrides the default space behavior, so update the extension's user-facing docs
and the command metadata to make this explicit: add or expand the description
for the command "demo-time.toggleAutoProceed" in the contributes.commands
section (and/or the extension README) to state that pressing Space in
"demo-time.presentation && demo-time.autoProceedActive == true" will
pause/resume auto-proceed, and mention any panels where default space behavior
is suppressed so presenters are aware.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/common/src/models/Demos.ts`:
- Line 54: Add JSDoc comments clarifying the time units for the numeric
autoAdvanceAfter property and the corresponding field on the Demo interface:
update the declaration for autoAdvanceAfter (and the Demo interface's
autoAdvanceAfter) to include a brief JSDoc like "`@param` autoAdvanceAfter -
number of milliseconds to wait before auto-advancing" (or seconds if you prefer,
but be explicit) so consumers know the expected units and behavior.

---

Nitpick comments:
In `@apps/vscode-extension/package.json`:
- Around line 916-919: The spacebar keybinding for demo-time.toggleAutoProceed
is scoped to presentation mode but overrides the default space behavior, so
update the extension's user-facing docs and the command metadata to make this
explicit: add or expand the description for the command
"demo-time.toggleAutoProceed" in the contributes.commands section (and/or the
extension README) to state that pressing Space in "demo-time.presentation &&
demo-time.autoProceedActive == true" will pause/resume auto-proceed, and mention
any panels where default space behavior is suppressed so presenters are aware.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4d9f43cd-e6f4-4cf3-91d3-b1ff705c19c9

📥 Commits

Reviewing files that changed from the base of the PR and between b1e9902 and b387f95.

📒 Files selected for processing (4)
  • apps/vscode-extension/package.json
  • apps/vscode-extension/src/extension.ts
  • packages/common/src/constants/Command.ts
  • packages/common/src/models/Demos.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant